package com.whc.controller;

import com.whc.service.ShellService;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wang-hai-cheng
 * @since 2021/12/11 13:01
 */
@RestController
@AllArgsConstructor
public class CommandController {
    ShellService shellService;

    @RequestMapping("on")
    public ResponseEntity<?> on() {
        return ResponseEntity.ok(shellService.on());
    }

    @RequestMapping("off")
    public ResponseEntity<?> off() {
        return ResponseEntity.ok(shellService.off());
    }

    @RequestMapping("stop")
    public void stop() {
        shellService.stop();
    }
}